package com.jk.config;

import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/***
 * @ClassName: SwaggerConfig
 * @Description:TODO
 * @Auther: 景晨璇
 * @Date: 2021/6/29 14:18
 * @version : V1.0
 */
@Configuration//声明当前类为一个配置文件类
@EnableSwagger2//开启swagger2注解扫描
public class SwaggerConfig {
    @Bean
    public Docket swaggrSpringMvcPlugin(){
        //构建swagger文档环境
        return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)).build();
    }
}
